package de.softcon.sc4retail.ui;

import de.softcon.sc4retail.R;
import de.softcon.sc4retail.R.id;
import de.softcon.sc4retail.R.layout;
import de.softcon.sc4retail.R.menu;
import de.softcon.sc4retail.domainmodel.ShoppingCart;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class OrderSummaryDialog extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.checkoutcomplete);	    	  
	    
	    //Reset content of shopping cart
	    ShoppingCart.getInstance().resetContent();
	}
	
	/**
	 * Creates the options menu for the shop view.
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.ordersummarymenu, menu);
	    return true;
	}
	
	/**
	 * Handles menu selection
	 */
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle menu item selection
	    switch (item.getItemId()) 
	    {
		    case R.id.showShop:
		    {
		    	startActivity(new Intent(OrderSummaryDialog.this, ShopItemDialog.class));
		        return true;		    	
		    }
		    default:
		        return super.onOptionsItemSelected(item);
	    }
	}
	
}
